<?php /*a:2:{s:64:"/Applications/MAMP/htdocs/application/index/view/live/index.html";i:1591126269;s:58:"/Applications/MAMP/htdocs/application/index/view/base.html";i:1591464705;}*/ ?>
<!doctype html>
<html lang="zn-en">
<head>
    <!-- Required meta tags -->
    <meta charset="utf-8">
    <!-- Bootstrap CSS -->
    <link rel="stylesheet" href="/../static/index/lib/css/bootstrap.css"  crossorigin="anonymous">
    <link rel="stylesheet" href="/../static/index/css/index.css">
    <link href="/../static/layui/css/layui.css" rel="stylesheet">
    <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"  crossorigin="anonymous"></script>
    <script src="/../static/index/lib/js/bootstrap.bundle.js" crossorigin="anonymous"></script>
    <script src="/../static/index/lib/js/bootstrap.js"  crossorigin="anonymous"></script>
    <script src="http://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
    <script type="text/javascript" src="/../static/layui/layui.all.js"></script>
    <title>首页</title>
</head>
<body>
<header class="header">
    <div class="logo">
        <div class="btitle d-inline-block p-1 pb-1">
            <img src="/../static/index/images/logo.png" alt="">
        </div>
        <div class="login">
            <i class="iconfont">&#xe7a5;</i>
            <?php if(empty(session('user_id'))): ?>
            <a href="<?php echo url('index/login/login'); ?>">登录</a>/<a href="<?php echo url('index/login/reg'); ?>">注册</a>
            <?php else: ?>
            <a href="<?php echo url('index/center/index'); ?>">个人中心</a>/ <a id="layout">退出</a>
            <?php endif; ?>

        </div>
    </div>

</header>
<nav>
    <ul>
        <li >
            <a class="" href="<?php echo url('index/index/index'); ?>">首页</a>
        </li>
        <li >
            <a class="" href="<?php echo url('index/article/index'); ?>">动态咨询</a>
        </li>
        <li >
            <a class="" href="<?php echo url('index/project/index'); ?>">视频课程</a>
        </li>
        <li >
            <a class="" href="<?php echo url('index/live/index'); ?>">在线直播</a>
        </li>
        <li>
            <a class="" href="<?php echo url('index/book/index'); ?>">图书商城</a>
        </li>
        <li>
            <a class="" href="<?php echo url('index/othvideo/index'); ?>">短视频专区</a>
        </li>
    </ul>
</nav>
<div class="main-content">

<?php if($liveList): ?>
<script src="/../static/index/lib/TcPlayer.js" charset="utf-8"></script>
<div id="video" class="video">
</div>
<div class="content">

    <?php echo htmlspecialchars_decode($liveList['live_content']); ?>
</div>
<script>
    var player =  new TcPlayer('video', {
        "m3u8": "<?php echo htmlentities($liveList['live_play_url']); ?>",
        "autoplay" : true,      //iOS 下 safari 浏览器，以及大部分移动端浏览器是不开放视频自动播放这个能力的

        "width" :  '1060',//视频的显示宽度，请尽量使用视频分辨率宽度
        "height" : '600'//视频的显示高度，请尽量使用视频分辨率高度
    });
</script>
<?php endif; if(!$liveList): ?>
<div class="live">
    <div class="per-video">
        <span>主播还未上线。。。</span>
        <button onclick="liveres(<?php echo session('user_id'); ?>)">立即预约</button>
    </div>

</div>
<script>
    layui.use('layer', function(){
        var layer = layui.layer;
    });
    function liveres(userid){
        $.post('<?php echo url("index/live/livereserve"); ?>',{id:userid},function (res) {
            if(res.code){
                layer.msg(res.msg,{icon:1});
            }else {
                layer.msg(res.msg,{icon:2});
            }
        })
    }

</script>
<?php endif; ?>


</div>
<footer>
    <div class="copyright">
        Copyright © 2010-2020 MHK国语在线推广学习平台 All Rights Reserved<br>
        陕ICP备19016245号-1
    </div>
</footer>


<script>
    layui.use('layer', function(){
        var layer = layui.layer;
    });
    $('#layout').click(function () {
            $.post("<?php echo url('index/login/layout'); ?>","",function (res) {
                if(res.code){
                    layer.msg("退出成功",{icon:1});
                    setTimeout(function () {
                        window.location.href="<?php echo url('index/index/index'); ?>"
                    },500)
                }else {
                    layer.msg(res.msg,{icon:2});
                }
            })
    })
</script>
</body>
</html>